// Standard drawing shader

#if defined(VERTEX) ///////////////////////////////////////////////////

layout(location=0) in vec3 aPosition;
layout(location=2) in vec2 aTexCoord;

layout(binding=0, std140) uniform TextureData{

	vec4 finalPositionScale; // x = posX, y = posY, z = scaleX, w = scaleY
	vec4 textureRect; // x = rectX, y = rectY, z = rectWidth, w = rectHeight

};

out vec3 vPosition;
out vec2 vTexCoord;

void main(){

	vTexCoord = vec2(textureRect.x + textureRect.z * aTexCoord.x, textureRect.y + textureRect.w * aTexCoord.y);
	vPosition = vec3((aPosition.xy * finalPositionScale.zw) + finalPositionScale.xy, 0);
	gl_Position = vec4(vPosition, 1);

}

#elif defined(FRAGMENT) ///////////////////////////////////////////////

in vec3 vPosition;
in vec2 vTexCoord;

uniform sampler2D uTexture;

layout(location = 0) out vec4 oColor;

void main(){ oColor = texture(uTexture, vTexCoord); }

#endif

